<?php header("Content-Type:text/html;   charset=utf-8"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=uft-8" />
<title>多文件上传控件uploadify火韦修改版</title>
<base href="<?php echo base_url();?>" />

<link rel="stylesheet" type="text/css" href="uploadify/uploadify.css" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript">
$(function(){
	$('#photoname').uploadify({  
		'swf':"/Js/lib/uploadify/uploadify.swf",  
		'uploader':"/Js/lib/uploadify/uploadify.php",  
		'cancelImg':"/Js/lib/uploadify/uploadify-cancel.png",  
		'debug':true,  
		'buttonText':'选择照片',  
		'method':'post',  
		'buttonClass':'upload_button',  
		'fileTypeDesc':'图片文件',  
		'fileTypeExts':'*.gif;*.jpg;*.png;*.bmp',  
		'formData':{'public_path'  :   PUBLIC},  
		'multi':false,
		'onUploadComplete': function(file){ 

		},  
		              
	             /** 
	              * 上传成功后触发事件 
		             */  
		'onUploadSuccess' : function(file, data, response) {
			//参数data保存的是上传后的图片的路径  
                 //alert(data);  
                 //$('#photo').css("background-color","#f00");  
		                   
		                 var path=PUBLIC+"/Uploads/Photo/"+data;  
		                 $('#photo>img').attr("src",path);  
		                 $('#photoname_hidden').val(data);  
		            },  
		        });  
});
</script>
</head>
<body>
	<form id="formCard" action="index.php/login/uploadImg" method="post"
		enctype="multipart/form-data">

		<p>
			<label class="label">照片</label>
			<table>
				<tr>
					<td>
						<div id="photo">
							<img src="__PUBLIC__/Uploads/Photo/default.jpg" />
						</div>
					</td>
				</tr>
			</table>
			<input class="text-input small-input" type="file" name="photo"
				id="photoname" />
		</p>
		<input type="hidden" name="photoname" id="photoname_hidden" />

	</form>
</body>
</html>
